using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using AjaxLabCmd.Objects.PlugIns;
using log4net;
using log4net.Config;

namespace AjaxLabCmd
{
	/// <summary>
	/// Summary description for CMDLogParserDemo.
	/// </summary>
	public class CMDLogParserDemo : System.Web.UI.Page
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(CMDLogParserDemo));

		[AjaxPro.AjaxMethod]
		public DataSet SelectTopVisits(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.SelectTopVisits(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet SelectSuccessfulAttemps(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.SelectSuccessfulAttemps(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopHits(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.PageHits(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopPageErrors(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.PageErrors(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopPossibleAttacks(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.PossibleAttacks(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet CompareIPsUserAgent(String IP1, String IP2)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.CompareIPsUserAgent(IP1, IP2);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopIPHitsPerPage(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.IPHitsPerPage(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopRecordedErrors(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.RecordedErrors(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopBrokenLinks(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.BrokenLinks(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopWin32Errors(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.Win32Errors(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopPageHttpMethods(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.PageHttpMethods(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopBytesSendToClient(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.BytesSendToClient(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopBytesSendFromClient(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.BytesSendFromClient(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopTimeSpentProcessing(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.TimeSpentProcessing(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		[AjaxPro.AjaxMethod]
		public DataSet TopNonStandardUserAgent(String X)
		{
			DataSet loginfo = new DataSet();
			IISLogParser lp = new AjaxLabCmd.Objects.PlugIns.IISLogParser();
			try
			{
				loginfo = lp.NonStandardUserAgent(X);
			}
			catch(Exception e)
			{
				log.Error("Error in select IP Count :"+e.Message+e.StackTrace);	
			}
			return loginfo;
		}

		public void Page_Load(object sender, System.EventArgs e)
		{
			log.Debug("type of class is :"+typeof(CMDLogParserDemo));
			AjaxPro.Utility.RegisterTypeForAjax(typeof(CMDLogParserDemo));
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);
		}
		#endregion
	}
}
